package com.cn.goodsadmin.common.frame;


import com.cn.goodsadmin.config.CgiConfig;
import com.cn.goodsadmin.listener.NormalRequest;
import com.cn.goodsadmin.listener.TempTestAns;

public class NetFactory {

    private static NetFactory factory;
    private static byte lock[] = new byte[0];

    private NetFactory() {

    }

    public static NetFactory getInstance() {
        if (factory == null) {
            synchronized (lock) {
                if (factory == null) {
                    factory = new NetFactory();
                }
            }
        }
        return factory;
    }

//    public BaseNetWork creatHttpNetWork(RequestInfo info) {
//
//        String key = info.requestKey;
//        if (CgiConfig.WXORDER.equals(key)) {
//            return new WeiXinPayRequest(info);
//        } else if (CgiConfig.WXORDERTEMPLATE.equals(key)) {
//            return new WeiXinTempGetOrderRequest(info);
//        } else if (CgiConfig.WXASKADVICETEMPLATE.equals(key)) {
//            return new WeiXinTempAskRequest(info);
//        }  else if(CgiConfig.WXBACKCARDTEMPLATE.equals(key)){
//            return new WeixinTempBackCardRequest(info);
//        } else if(CgiConfig.WXDAYCARDTIPSTEMPLATE.equals(key)){
//            return new WeiXinTempCardPastRequest(info);
//        }
//        return new NormalRequest(info);
//    }
//
//    public BaseNetAns creatHttpAns(RequestInfo info) {
//        String key = info.requestKey;
//        if (CgiConfig.WXORDER.equals(key)) {
//            return new WeiXinOrderNetAns();
//        } else if (CgiConfig.WXOPENID.equals(key)) {
//            return new WxOpenidNetAns();
//        }
//        return new TempTestAns();
//    }
public BaseNetWork creatHttpNetWork(RequestInfo info) {

    String key = info.requestKey;
    return new NormalRequest(info);
}

    public BaseNetAns creatHttpAns(RequestInfo info) {
        String key = info.requestKey;
        return new TempTestAns();
    }
}
